<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script>
        /* 
            需求：把A数组的元素放到B数组
         */

         const array1 = ['aa','bb','cc']
         const array2 = []
         //将array1的数据复制到array2

         //方式一
      /*    for(let i = 0; i<array1.length; i++){
             array2.push(array1[i])
         }
         console.log(array2) */

         //方式二
         for(let item of array1){
            //  array2.push(item)
         }

         //方式三
         array1.forEach(item => 
             array2.push(item)
         )
         console.log(array2)

         array2.forEach(item => console.log(item))
    </script>
</head>
<body>
    
</body>
</html>